(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Antoine Potten
Title=DVDZone2
Description=English version of DVDZone2
Site=http://www.dvdzone2.com
Language=EN
Version=
Requires=3.5.0
Comments= Rewritten by Antoine Potten| Currently it is only possible to get information in english : cookie or session support is needed to change language
License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
GetInfo=1
[Options]
***************************************************)
program DVDZone2_FR;
var
MovieName: string;
function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
i: Integer;
begin
result := -1;
if StartAt < 0 then
StartAt := 0;
for i := StartAt to List.Count-1 do
if Pos(Pattern, List.GetString(i)) <> 0 then
begin
result := i;
Break;
end;
end;
procedure AnalyzePage(Address: string);
var
Line, MovieItem, MovieTitle, MovieAddress: string;
TitlePos, BeginPos, EndPos: Integer;
List: TStringList;
begin
Line := GetPage(Address);
PickTreeClear;
if Pos(' : 0 item(s) found ', Line);
Delete(Line, 1, BeginPos + 2);
EndPos := Pos(#13, Line);
Value := StringReplace(Copy(Line, 1, EndPos - 1), ' ', #13#10#13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(FieldDescription, Value);
// rating
BeginPos := Pos('Global rating', Line);
if BeginPos > 0 then
begin
Delete(Line, 1, BeginPos);
BeginPos := Pos('', Line);
if BeginPos > 0 then
begin
BeginPos := BeginPos + 3;
EndPos := Pos(',', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldRating, Value);
end;
end;
Page := TStringList.Create;
BeginPos := Pos('
', Line) = 0 then
begin
PickTreeAdd('Search results from DVDZone2', '');
BeginPos := Pos('', Line);
EndPos := Pos('', Line);
Line := Copy(Line, BeginPos, EndPos - BeginPos);
List := TStringList.Create;
repeat
TitlePos := Pos('', MovieItem) + 2;
EndPos := Pos('', MovieItem);
MovieTitle := Copy(MovieItem, BeginPos, EndPos - BeginPos);
List.Text := MovieItem;
MovieItem := Trim(List.GetString(3));
if MovieItem <> '' then
MovieTitle := MovieTitle + ' [' + MovieItem + ']';
MovieItem := Trim(List.GetString(9));
if MovieItem <> '' then
MovieTitle := MovieTitle + ' (' + MovieItem + ')';
PickTreeAdd(MovieTitle, MovieAddress);
Delete(Line, 1, 25);
end;
until TitlePos = 0;
List.Free;
end;
if PickTreeExec(Address) then
AnalyzeMoviePage(Address);
end;
procedure AnalyzeMoviePage(Address: string);
var
Line, Value, FullValue: string;
LineNr: Integer;
BeginPos, EndPos: Integer;
Page: TStringList;
begin
Line := GetPage(Address);
BeginPos := Pos('', Line);
EndPos := Pos('', Line);
Line := Copy(Line, BeginPos, EndPos - BeginPos);
// title
BeginPos := Pos('', Line);
Delete(Line, 1, BeginPos);
BeginPos := Pos('>', Line) + 1;
EndPos := Pos('', Line);
Value := Copy(Line, BeginPos, EndPos - BeginPos);
HTMLDecode(Value);
SetField(fieldOriginalTitle, Value);
// picture
BeginPos := Pos('http://www.dvdzone2.com/pictures/big/', Line);
if BeginPos > 0 then
begin
Delete(Line, 1, BeginPos - 1);
EndPos := Pos('"', Line);
Value := Copy(Line, 1, EndPos - 1);
GetPicture(Value);
end;
// description
BeginPos := Pos('